/*
 * Copyright 2003-2007 (c) Live Media Pty Ltd. <argot@einet.com.au> 
 *
 * This software is licensed under the Argot Public License 
 * which may be found in the file LICENSE distributed 
 * with this software.
 *
 * More information about this license can be found at
 * http://www.einet.com.au/License
 * 
 * The Developer of this software is Live Media Pty Ltd,
 * PO Box 4591, Melbourne 3001, Australia.  The license is subject 
 * to the law of Victoria, Australia, and subject to exclusive 
 * jurisdiction of the Victorian courts.
 */

package com.colony.remote.rpc;

import java.lang.reflect.Proxy;

import com.argot.remote.MetaInterface;
import com.argot.remote.MetaLocation;
import com.colony.IProxyFactory;


public class RpcMetaStubFactory
implements IProxyFactory
{
	private MetaInterface _mClass;
	private Class _frontClass;
	private RpcMetaClient _client;
	
	public RpcMetaStubFactory( RpcMetaClient client, MetaInterface mClass, Class frontClass )
	{
		_mClass = mClass;
		_frontClass = frontClass;
		_client = client;
	}
	
	public Object getProxy(MetaLocation location ) 
	{
		RpcMetaStub stub = new RpcMetaStub( _client,  location, _mClass );						
		return Proxy.newProxyInstance(_frontClass.getClassLoader(),
														 new Class[] { _frontClass }, stub );
	}
}